package com.xyh.flowershop.vo.resp.common;


import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Data
public class ResultRespVo {

    @Schema(description = "响应码")
    private Integer respCode;

    @Schema(description = "响应信息")
    private String respMsg;

    @Schema(description = "响应结果")
    private Object data;

    private ResultRespVo(){}
    private ResultRespVo(Integer respCode, String respMsg){
        this.respCode = respCode;
        this.respMsg = respMsg;
    }
    private ResultRespVo(Integer respCode, String respMsg, Object data){
        this(respCode,respMsg);
        this.data = data;

    }

    public static ResultRespVo info(Integer code, String msg){
        return new ResultRespVo(code,msg);
    }

    public static ResultRespVo success(Integer code, String msg, Object data){
        return new ResultRespVo(code,msg, data);
    }

    public static ResultRespVo success(Integer code, String msg){
        return new ResultRespVo(code, msg, "处理成功");
    }
    public static ResultRespVo success(Object data){
        return new ResultRespVo(200, "处理成功", data);
    }

//    public static ResultRespVo success(String data){
//        return new ResultRespVo(200, data, null);
//    }

    public static ResultRespVo success(){
        return new ResultRespVo(200, "处理成功","处理成功");
    }

    public static ResultRespVo error(){
        return new ResultRespVo(201,"处理失败","处理失败");
    }

    public static ResultRespVo error(Object data){
        return new ResultRespVo(201,"处理失败",data);
    }


    public static ResultRespVo error(Integer code, String msg){
        return new ResultRespVo(code, msg ,"");
    }

}
